﻿using Risk.Services;

namespace Site.Models
{
    /// <summary>
    /// Data transfer object for a player
    /// </summary>
    public class PlayerDTO
    {
        public PlayerDTO(int uniqueId)
        {
            UniqueId = uniqueId;
        }
        public int UniqueId { get; set; }
        /// <summary>
        /// The id of the player
        /// </summary>
        public int Id { get { return DatabaseManager.GetPlayerRiskId(UniqueId); } }

        /// <summary>
        /// The name of the player
        /// </summary>
        public string Name {
            get { return DatabaseManager.GetPlayerName(UniqueId); }
        }

        /// <summary>
        /// The color of the player
        /// </summary>
        public string Color { get { return DatabaseManager.GetPlayerColor(UniqueId); } set { DatabaseManager.SetPlayerColor(UniqueId, value); } }

        /// <summary>
        /// The state of the player
        /// 
        /// 0 = waiting, 1 = initial, 2 = placing, 3 = attacking, 4 = moving
        /// </summary>
        public int State { get { return DatabaseManager.GetPlayerState(UniqueId); } set { DatabaseManager.SetPlayerState(value, UniqueId); } }
    }
}